#ifndef A8255_H_
#define A8255_H_

#include "system.h"
#include "alt_types.h"

#define cs      NCS_BASE
#define rd      NRD_BASE
#define wr      NWR_BASE
#define address ADDR_BASE
#define DIN     DIN_BASE
#define DOUT    DOUT_BASE

#define PA      0
#define PB      1
#define PC      2
#define CTRL    3

#define CTRL_WORD   0x81

#define MASK        0x04

#define RSTB        0x0e

#define STB         0x0f

void _8255_IN(unsigned char port, unsigned char *data);
void _8255_OUT(unsigned char port, unsigned char data);
unsigned char _8255_QUERY(unsigned mask);
void _8255_LOOP_QUERY(unsigned mask);

#endif /*A8255_H_*/
